package sd.qd.xiaoming.coffeedesk.dao;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import sd.qd.xiaoming.coffeedesk.entity.CdDict;

@Repository
public class CdDictDAO extends BaseDAO<CdDict> {

	protected CdDictDAO() {
		super(CdDict.class);
	}

	@PersistenceContext
	private EntityManager entityManager;



	public CdDict findByCode(final String code) {
		Query query = this.entityManager.createQuery(
				"select d from CdDict d where d.code=:code");
		query.setParameter("code", code);
		return (CdDict) query.getSingleResult();
	}

}
